package com.systop.asset.controller;

import java.util.List;
import com.systop.asset.entity.RestResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.systop.asset.entity.AssetAssignmentsDetail;
import com.systop.asset.service.IAssetAssignmentsDetailService;


/**
 * 资产领用详情Controller
 * 
 * @author mc
 * @date 2025-07-02
 */
@RestController
@RequestMapping("/system/assignmentDetail")
public class AssetAssignmentsDetailController{
    @Autowired
    private IAssetAssignmentsDetailService assetAssignmentsDetailService;

    /**
     * 查询资产领用详情列表
     */
    @GetMapping("/list")
    public RestResponse list(AssetAssignmentsDetail assetAssignmentsDetail)
    {
        List<AssetAssignmentsDetail> list = assetAssignmentsDetailService.selectAssetAssignmentsDetailList(assetAssignmentsDetail);
        return RestResponse.success(list);
    }


    /**
     * 获取资产领用详情详细信息
     */
    @GetMapping(value = "/{id}")
    public RestResponse getInfo(@PathVariable("id") Long id)
    {
        return RestResponse.success(assetAssignmentsDetailService.selectAssetAssignmentsDetailById(id));
    }

    /**
     * 新增资产领用详情
     */
    @PostMapping
    public RestResponse add(@RequestBody AssetAssignmentsDetail assetAssignmentsDetail)
    {
        return RestResponse.success(assetAssignmentsDetailService.insertAssetAssignmentsDetail(assetAssignmentsDetail));
    }

    /**
     * 修改资产领用详情
     */
    @PutMapping
    public RestResponse edit(@RequestBody AssetAssignmentsDetail assetAssignmentsDetail)
    {
        return RestResponse.success(assetAssignmentsDetailService.updateAssetAssignmentsDetail(assetAssignmentsDetail));
    }

    /**
     * 删除资产领用详情
     */
	@DeleteMapping("/{ids}")
    public RestResponse remove(@PathVariable Long[] ids)
    {
        return RestResponse.success(assetAssignmentsDetailService.deleteAssetAssignmentsDetailByIds(ids));
    }
}
